package com.lawfinal.utils;

import lombok.Data;

@Data                                                            //set get
public class Result {
      private int code;
      private String msg;                             //成功失败
      private Long total;                               //总条数
      private Object data;                            //数据

      private static Result result(int code,String msg,Long total,Object data){
            Result result = new Result();

            result.setData(data);
            result.setMsg(msg);
            result.setCode(code);
            result.setTotal(total);

            return  result;
      }

      public static Result fail(){
            return  result(400,"失败",0L,null);
      }
      public static Result sucess(){
            return  result(200,"成功",0L,null);
      }
      public static Result sucess(Object data){
            return  result(200,"成功",0L,data);
      }
      public static Result sucess(Object data,Long total){
            return  result(200,"成功",total,data);
      }

}
